package cn.wolfcode.wolf2w.util;

import cn.wolfcode.wolf2w.exception.LogicException;
import org.springframework.lang.Nullable;
import org.springframework.util.StringUtils;

/**
 * 参数断言工具类
 */
public class AssertUtil {

    public static void hasLength(@Nullable String text, String message) {
        if (!StringUtils.hasLength(text)) {
            throw new LogicException(message);
        }
    }

    public static void isEquals(String v1, String v2, String msg) {

        if (v1 == null || v2 == null){
            throw new LogicException(msg);
        }


        if (!v1.equals(v2)){
            throw  new LogicException(msg);
        }
    }
}
